package com.ohxwj.modules.web.service.impl;

import com.ohxwj.modules.web.dao.WebMenuDao;
import com.ohxwj.modules.web.entity.WebMenuEntity;
import com.ohxwj.modules.web.service.WebMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018-04-16.
 */
@Service("webMenuService")
public class WebMenuServiceImpl implements WebMenuService {

    @Autowired
    private WebMenuDao webMenuDao;

    @Override
    public void insertMenu(WebMenuEntity webMenuEntity) {
        webMenuDao.save(webMenuEntity);
    }

    @Override
    public int updateMenu(WebMenuEntity webMenuEntity) {
        return webMenuDao.update(webMenuEntity);
    }

    @Override
    public List<WebMenuEntity> queryMenus() {
        return webMenuDao.queryList(null);
    }

    @Override
    public int deleteMenu(int id) {
        return webMenuDao.delete(id);
    }

    @Override
    public WebMenuEntity loadWebMenuById(int id) {
        return webMenuDao.queryObject(id);
    }

    @Override
    public List<WebMenuEntity> queryByParentId(int parentId) {
        return webMenuDao.queryByParentId(parentId);
    }

    @Override
    public List<WebMenuEntity> queryNextMenuByParentId(int parentId) {
        return webMenuDao.queryNextMenuByParentId(parentId);
    }
}
